package cn.kgc.service.impl;


import cn.kgc.mapper.StandardMapper;
import cn.kgc.pojo.Standard;
import cn.kgc.service.StandardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("standardService")
public class StandardServiceimpl implements StandardService {

    @Resource
    StandardMapper standardMapper;

    @Override
    public int getCount(String zhname) {
        return standardMapper.getCount(zhname);
    }

    @Override
    public List<Standard> getByPage(Integer currentpageNo, Integer pageSize, String zhname) {
        Integer pageNo = (currentpageNo-1)*pageSize;
        return standardMapper.getByPage(pageNo,pageSize,zhname);
    }

    @Override
    public Standard getStandardById(Integer id) {
        return standardMapper.getStandardById(id);
    }

    @Override
    public boolean updateStandard(Standard standard) {
        int conut = standardMapper.updateStandard(standard);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean addStandard(Standard standard) {
        int conut = standardMapper.addStandard(standard);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delId(Integer id) {
        int conut = standardMapper.delId(id);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Standard getName(String stdNum) {
        return standardMapper.getName(stdNum);
    }
}
